/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Entity;

import static javax.persistence.InheritanceType.TABLE_PER_CLASS;

import VO.UserVO;
import java.io.Serializable;
import javax.persistence.*;

/**
 *
 * @author usuario
 */
@Entity
@Table(name = "usuario")
@Inheritance(strategy = TABLE_PER_CLASS)
public class User implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    private Long id;
    private String nameUser;
    private String login;
    private String password;
    private String rol;

    public UserVO toVO(User user) {
    UserVO vo = new UserVO();
    vo.setId(user.getId());
    vo.setNameUser(user.getNameUser());
    vo.setLogin(user.getLogin());
    vo.setPassword(user.getPassword());
    
    return vo;
}
    
    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getLogin() {
        return login;
    }

    public void setLogin(String login) {
        this.login = login;
    }

    public String getNameUser() {
        return nameUser;
    }

    public void setNameUser(String nameUser) {
        this.nameUser = nameUser;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public String getRol() {
        return rol;
    }

    public void setRol(String rol) {
        this.rol = rol;
    }

    
    
    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof User)) {
            return false;
        }
        User other = (User) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "Entity.User[ id=" + id + " ]";
    }
    
}
